package toanstt.com.menu;

import toanstt.com.MatchUp.App;
import toanstt.com.MatchUp.ButtonCenter;
import toanstt.com.MatchUp.MainActivity;
import toanstt.com.MatchUp.SCR;
import toanstt.com.MatchUp.Sound2;
import toanstt.com.MatchUp.T;
import android.graphics.Canvas;
import android.view.MotionEvent;

public class MenuNewGame 
{
	ButtonCenter[] buttons;
	public MenuNewGame()
	{
		int i;
		if(T.ISHORIZONTAL)
		{
			
			{
				buttons = new ButtonCenter[5];
				for(i =0;i<4;i++)
					buttons[i] = new ButtonCenter(T.TBITMAP_BUTTON_MENU.bitmap[i+4],T.DISPLAY_WIDTH/2,(int)((i+1.5)*4*T.U2));
				i = 4;
				//buttons[i] = new ButtonCenter(T.TBITMAP_BUTTON_MENU.bitmap[13],T.DISPLAY_WIDTH/2,(int)((i+1)*4*T.U2));
				buttons[i] = new ButtonCenter(T.TBITMAP_BUTTON_MENU.bitmap[13],T.DISPLAY_WIDTH/2,(int)(T.DISPLAY_HEIGHT - 50-(int)(2*T.U2)));
			}
		}
		
	}
	int d;
	public void Draw(Canvas canvas)
	{
		
		if(T.THEME_WHITE == true)
			canvas.drawBitmap(T.TBITMAP_THEME_WHITE.bitmap[0], 0, 0, null);
		else
			canvas.drawBitmap(T.TBITMAP_THEME_BLACK.bitmap[0], 0, 0, null);
		canvas.drawBitmap(T.TBITMAP_BANER.bitmap[0],T.DISPLAY_WIDTH/2 - T.TBITMAP_BANER.bitmap[0].getWidth()/2, (int)(T.U2/2), null);
		for(d =0;d<5;d++)
			buttons[d].Draw2(canvas);
	}
	int t2;
	public void touch(MotionEvent mo)
	{
		
		
		
		for(t2 =0;t2<5;t2++)
		{
			if(buttons[t2].Kick(mo))
			{
				T.sounds.Play(Sound2.BUTTON_CLICK);
				if(t2 <4)
				{
					if(t2 > T.PLAYER_I1)
					{
						T.TOAST("You must finish previous level first!");
						//break;
					}
					App.thumbs.thumb_index =t2;
					if(T.SCREEN_TEMP == -1)
					{
						T.SCREEN_TEMP = SCR.THUMB;
						T.ALPHA =T.ALPHA_COUNT_MAX;
					}
				}
				
				else if(t2 ==4)
				{
					if(T.SCREEN_TEMP == -1)
					{
						T.SCREEN_TEMP = SCR.MENU;
						T.ALPHA =T.ALPHA_COUNT_MAX;
					}
				}
				break;
			}
			
		}
		//
		switch(App.action)
		{
			case MotionEvent.ACTION_DOWN:
				
			break;
			
			case MotionEvent.ACTION_UP:
				for(t2 =0;t2<5;t2++)
					buttons[t2].anpla = 255;
			break;
			
			case MotionEvent.ACTION_MOVE:
			break;

		}
	}
}
